import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

public class Cxx {

    private static final String 注释= """
            1. 配置方法
            2. 衔接方法是否统一     [如果足够底层,可以统一]
            3. 在第二阶段获取数据方式
            4. 二阶段,后序遍历次序
            5 .递归结构
            6. 对递归结构的遍历.迭代器模式?
            """;
    @Test
    public void Tex11(){
        System.out.println(注释);
    }

    //暴露给子类
    public static class Ability{

    }
    //所有节点的共同配置,
    public static class Config{

    }

    public interface BaseNode<T> {
        T getV();
        void setV(T v);
        boolean addChild(T c);
        List<Node<T>> getChildren();
    }

    public static class Node<T>{
        private T v;

        public T getV() {
            return v;
        }

        public void setV(T v) {
            this.v = v;
        }

        private List<Node<T>> child;

        boolean addChild(T c){
            Objects.requireNonNull(child);
            var n=new Node<T>();
            n.setV(c);
            return child.add(n);
        }
        List<Node<T>> getChildren(){
            return child;
        }
        public void setChild(List<Node<T>> child) {
            this.child = child;
        }
    }

    @FunctionalInterface
    public interface Doo{
        void doo();
    }

    //flow to
    //konck konck
    public static class River{
        private Node<River> cc1;
        public River(){
            cc1=new Node<>();
            cc1.setChild(new ArrayList<>());
            cc1.setV(this);
        }
        public River knockKnock(){
            var river = new River();
            addChild(river);
            return river;
        }
        public River flowTo(){
            var river = new River();
            addChild(river);
            return river;
        }
        public List<River> getChildren(){
            return cc1.getChildren().stream().map(i->i.getV()).collect(Collectors.toList());
        }
        boolean addChild(River c){
            return cc1.addChild(c);
        }
    }
    protected Ability ability;
    protected Node<Doo> root;
}
